// 按人天计算人力费用
var MathUtil = Java.type('com.kunlong.util.MathUtil');
var math = MathUtil.getInstance();
/**
 * 结算
  支付金额 = 上班天数*单价 + 加班天数*单价*2 + 节日加班天数*单价*3
 */
function compute(computeParam,payResult,ruleParams){

    var baseParam = JSON.parse(ruleParams);
    var otTimes = baseParam.overtimeTimes || 1;
    var holidayOtTimes = baseParam.holidayTimes || 1;

    var price = computeParam.getPrice();
    var workDays = computeParam.getWorkDays();
    var overtimeDays = computeParam.getOvertimeDays();
    var holidayOtDays = computeParam.getHolidayOtDays();

    var amount = math.multiply(price, workDays );
    var otprice = math.multiply( price, otTimes );
    var amountOt = math.multiply( otprice, overtimeDays );

    var holidayOtprice = math.multiply(price, holidayOtTimes );
    var amountHolidayOt = math.multiply(holidayOtprice, holidayOtDays );

    payResult.setEmpId(computeParam.getEmpId());
    var i=computeParam.getLst().get(0);
    var subParam=computeParam.getSubParams().get(0);
    payResult.setRemark("人天结算结果： 支付金额=上班天数*单价 + 加班天数*单价*2 + 节日加班天数*单价*3 "+subParam.getId());
    payResult.setAmount(amount.add(amountOt).add(amountHolidayOt));

}
